package de.nabble.gui;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.List;

import javax.swing.JLabel;
import javax.swing.JPanel;

import de.nabble.model.Player;
import de.nabble.util.Helper;

public class PointsPanel extends JPanel {

	private List<Player> players;
	private ColorTheme theme;
	
	public PointsPanel(List<Player> players) {
		this.players = players;
		theme = ColorTheme.getInstance();
		
		setBackground(theme.getColor("boardBgColor"));
		
		setLayout(new GridLayout(players.size() + 1, 1));
		add(new JLabel(Helper.getResource("Points.label")));
		setPreferredSize(new Dimension(200, 300));
		
		listPoints();
	}
	
	public void listPoints() {
		for(Player p : players) {
			add(new JLabel(p.getName() + ": " + p.getPoints()));
		}
	}

	private static final long serialVersionUID = 7661855300828757440L;

}
